#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtGui/QMainWindow>
#include <QXmlStreamReader>
#include <QLineEdit>
#include "www_data.h"
#include "text_edit.h"


namespace Ui
{
    class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:

    MainWindow(QWidget *parent = 0);
    ~MainWindow();
    int Col_Count;
    bool data_state;
    QString File;    
    int group_count;
    int group_time_count;
    int interval;


    bool readFile(const QString &fileName);

private:
    Ui::MainWindow *ui;
    double scaleFactor;     //open imagefile (ratio of image)
    QString gpxPath;
    QLineEdit *tag_name;
    QDialog *image_tagging;
    QList<QGroupBox*> group_box_list;
    QList<QGroupBox*> time_group_box_list;
    QList<QListWidget*> time_group_item_view_list;
    QList<QListWidget*> tag_group_item_view_list;
    QStringList time_group_lat;
    QStringList time_group_lon;
    QStringList gpx_file_name;
    QTableWidget *gpx_arrange_data;

    /************************************************************
    // tag group : DIG
    ************************************************************/
    QGroupBox *group_box;
    QVBoxLayout *layout;
    QListWidget *group_item_view;
    QStringList tag_group_info;

    /************************************************************
    // new project : DIG
    ************************************************************/
    QDialog *new_DIG;
    QLineEdit *image_path;
    QLineEdit *gps_path;
    QSpinBox *interval_box;
    QPushButton *image_load;
    QPushButton *gps_load;
    QPushButton *create;
    QPushButton *new_cancel;    
    QStringList *image_files;
    QLabel *image_label;
    QLabel *newLabel;
    bool new_image_flag;
    bool new_gps_flag;

    /************************************************************
    // delete group : DIG
    ************************************************************/
    QDialog *delete_message_DIG;
    QLabel *message_label;
    QPushButton *delete_cancel;
    QPushButton *delete_ok;

public slots:
    void delete_group();
    void delete_time_group();

private slots:
    /************************************************************
    // dialog
    ************************************************************/
    void about();
    int Find_and_Replace();
    int Merge_DIG();    
    void add_toolbar();
    /************************************************************
    // new file
    ************************************************************/
    void new_project();
    void click_new_image();
    void click_new_gps();
    void create_new_enable();
    void new_image_open();
    void new_gps_open();
    void new_create();
    /************************************************************
    // save and load
    ************************************************************/
    void data_save();
    void data_save_as();
    void data_save_check();
    void data_load();
    /************************************************************
    // image
    ************************************************************/
    int image_viewDIG();
    int group_image_viewDIG(QListWidgetItem*);
    void textedit_image_view(QString path);
    void image_list_open();
    void image_list_delete();
    void image_tagging_DIG();
    void image_input_tag();
    void image_file_open(int image_count, QStringList* image_path_list, int who);
    /************************************************************
    // gps
    ************************************************************/
    void gps_list_open();
    void gps_list_delete();
    void gps_file_open(QString *filePath);
    /************************************************************
    // memo
    ************************************************************/
    void text_editDIG();
    void memo_list_add();
    void memo_list_delete();    
    void memo_list_insert(int row_count, text_edit* memo_edit);
    QList<QTableWidgetItem*> memo_containg_lmage_list();
    /************************************************************
    // group making
    ************************************************************/
    void group_to_map();
    void create_group_ui(QString title);
    void create_time_group_ui(QString date);    
    void group_make_tag();
    void group_make_time();
    void group_box_delete();

};


#endif // MAINWINDOW_H

